package org.melord.cap;

import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class Site {
	String url;

	public void test(){
		

		Display display = new Display();
		final Shell shell = new Shell(display);

		shell.open();
		final Popup.Callback popupCallback = new Popup.Callback(){

			@Override
			public void onDismiss(Host host) {
				 System.out.println("onDismiss");
				 shell.dispose();
			}
			
		};
		shell.getDisplay().asyncExec(new Runnable() {

			@Override
			public void run() {
				Popup popup = new Popup(new Host(), popupCallback);
				popup.start();
			}

		});
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch())
				display.sleep();
		}
		display.dispose();
		System.out.println("exit main");
	}
	public static void main(String[] args) {
		Site s = new Site();
		s.test();
		try {
			Thread.sleep(1000);
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		s.test();
	}
}
